library(SmarterPoland)
population <- getEurostatRCV(kod = "demo_gind")
population<-subset(population, indic_de=='AVG' & as.numeric(as.character(time))=='2001')
population<-subset(population, geo=='AT'| geo=='BG'| geo=='CY'
                   | geo=='CZ'| geo=='DE_TOT'| geo=='DK'| geo=='EE'| geo=='EL'
                   | geo=='ES'| geo=='FI'| geo=='FR'| geo=='HU'
                   | geo=='IE'| geo=='IT'| geo=='LT'| geo=='LU'
                   | geo=='LV'| geo=='NL'| geo=='PL'| geo=='PT'
                   | geo=='RO'| geo=='SI'| geo=='SK'| geo=='UK')
#Recode the countries to match
population$geo<-recode(population$geo, '"UK"="GB"; "DE_TOT"="DE";"EL"="GR"')
#Calculate the proportion
population$prop<-population$value/sum(population$value)
#order the data
population<-population[order(population$geo),]
#equal share proportions
population$prop_eq<-24/1500
#write the table
write.table(population, "E:/population2001.txt")